from Chessnut import Game
import k

chessgame = Game()

def StrGame(game):
    game = str(game)
    game = list(game)
    out = ""
    i = 0
    while True:
        if game[i] != " ":
            out = out + str(game[i])
            i += 1
        else:
            break
    return out

def boardlist(fen):
    out = ""
    fen = list(fen)
    while "1" in fen:
        fen[fen.index("1")] = " "
    while "2" in fen:
        fen[fen.index("2")] = "  "
    while "3" in fen:
        fen[fen.index("3")] = "   "
    while "4" in fen:
        fen[fen.index("4")] = "    "
    while "5" in fen:
        fen[fen.index("5")] = "     "
    while "6" in fen:
        fen[fen.index("6")] = "      "
    while "7" in fen:
        fen[fen.index("7")] = "       "
    while "8" in fen:
        fen[fen.index("8")] = "        "
    while "/" in fen:
        del fen[fen.index("/")]
    for i in fen:
        out = out + i
    return list(out)

def printreplace(boardlist):
    out = ""
    piece = {'R':'♜', 'N':'♞', 'B':'♝', 'Q':'♛', 'K':'♚', 'P':'♟',
                  'r':'♖', 'n':'♘', 'b':'♗', 'q':'♕', 'k':'♔', 'p':'♙', ' ':'.'}
    for i in boardlist:
        out = out + piece[i]
    return out
    
# print(printreplace(boardlist(StrGame(chessgame))))
# print(boardlist(StrGame(chessgame)))
# print(StrGame(chessgame))
# print(len(boardlist(StrGame(chessgame))))
# print("1234")
